package base.standard.exception;

import base.standard.constant.ErrorCode;
import lombok.Data;
import org.springframework.http.HttpStatus;

/**
 * Simpile exception
 *
 * @description:
 * @author: cyj
 * @date 2020 -10-15 10:54:49
 */
@Data
public class SimpleException extends RuntimeException{

    private String message;

    private String code;

    private HttpStatus httpStatus;

    public SimpleException(ErrorCode errorCode, Object... params) {
        this.message = String.format(errorCode.message, params);
        this.code = errorCode.code;
        this.httpStatus = errorCode.httpStatus;
    }
}
